Skip to main content

All Questions

7votes
4answers
969views

Creates class and makes animals, then print bios

...
LMays's user avatar
6votes
2answers
706views

What is the best way to set a class value to a variable in Python if it exists in a dictionary?

I have this code which sets values in a location class from values from JSON data. ...
Asher Ross's user avatar
2votes
2answers
134views

Alternate **kwargs for class __init__ function [closed]

I want to set up a Python class so that it can be constructed with one set of parameters or another. I'm trying to mimic C++ function templates. I tried alternate constructors. In the actual code I'm ...
JDT's user avatar
  • 81
3votes
1answer
97views

Random generation of points for the graphs of 3 stock share parameters

I currently studying OOP and related design patterns, and tried to implement random data generation for some stock charts using OOP as an exercise. This code randomly generates data points for 3 ...
Jin22's user avatar
0votes
3answers
168views

Declaring type definition once for all variables

To avoid the use of magic numbers, I created a static class to store some integer values that are represented inside a database. I avoided using enums because I need to cast them every time I use them....
Abcd's user avatar
  • 103
3votes
2answers
132views

Defining hardware components structure

I'm writing firmware for my Arduino project, and I'm struggling with a clean, scalable hardware mapping structure. Initially, I had the following namespace: ...
Dead1nside's user avatar
2votes
1answer
107views

HTML form Class

After my previous question I revised the code to the code below. I am using PHP 7.0.33 and tried to accomplish PSR-12 as much as I could. In "condensed usage" in the docblock you can find a ...
julio's user avatar
2votes
1answer
109views

Making a game using python and pygame

I am making a game using python and pygame and as my game started to grow, in some of my classes the number of instance variables started to get big. Like in the settings class is like this: ...
Alex's user avatar
  • 123
2votes
1answer
162views

Java program for complex math utilities

I've got 2 Java programs, with the aim of solving some matrix math that involves complex numbers (an EE problem). Both programs have main functions, the one with all the complex math operations has a ...
Aloy's user avatar
0votes
1answer
81views

GPG class for AJAX calls

I want to know if this GPG class in PHP is up to snuff as a professional-level class. I did my best to include everything and make it easy to use. I'm calling the object by invoke(). If anyone can ...
Anthony Pulse's user avatar
2votes
3answers
139views

Rock Paper Scissors with file save/load

Took me a couple days and I had to make 2 versions. Version 1.2 is better looking and more readable, with better functionality. No where near optimized though, as I know nothing about that. Save and ...
Beginner's user avatar
1vote
1answer
147views

Interconnect Recipe and Notes

I'm currently working through a tutorial. The project is a recipe website. One of the lessons to "save some lines of code" and use bidirectional setters for bidirectional relations of ...
Benjamin Basmaci's user avatar
4votes
1answer
218views

Simple console menu backend with calculator implementation in Python

I've written a simple calculator in Python. I want to show not much effect of the action but the logic behind it, by that I mean console menu implementation in the ...
whiteman808's user avatar
3votes
0answers
75views

A Haskell-style "maybe" type in Python, version 2

I have decided on a preferred solution to my question A maybe type in Python. Which implementation is best?, and have expanded it to be more ergonomic. I have implemented a host of utility functions (...
schuelermine's user avatar
2votes
2answers
58views

Object Oriented Hangman in Python (version 1.0)

As always, I am looking for as much criticism as possible. Forums and exchanges like this are where I have received my most solid feedback. Enjoy! Github hangman repository The code that I import is ...
Infinite Grasp's user avatar

153050per page
close